<template>
	<view class="news">
		<view class="newsitem" v-for="item in news" :key="item.objectId" @click="gotoDetail(item.objectId)">
			<image :src="item.newsImg"></image>
			<view class="right">
				<view class="title">{{item.newsTitle}}</view>
				<view class="info">
					<text>发布时间:{{item.newsTime}}</text>
					<text>浏览次数:{{item.counts}}次</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import goodsList from '../../components/goodsList/goodsList.vue'
	import Bmob from '../../bmob/Bmob-2.2.4.min.js'
	export default {
		data() {
			return {
				news:[]
			}
		},
		methods: {
			getNewsFromBmob() {
				const query = Bmob.Query('newsList')
				query.find().then(res => {
					for (var item of res) {
						this.news.push(item)
					}
				})
			},
			gotoDetail(id){
				uni.navigateTo({
					url:"../meaasage-detail/meaasage-detail?objectId="+id,

				})
			}
		},
		onLoad() {
			this.getNewsFromBmob()
		}
	}
</script>

<style lang="scss">
	.news {

		.newsitem {
			display: flex;
			padding: 10rpx 20rpx;
			border-bottom: 1px solid $my-uni;

			image {
				max-width: 200rpx;
				min-width: 200rpx;
				height: 150rpx;
			}

			.right {
				margin-left: 15rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.title {
					font-size: 39rpx;
				}

				.info {
					display: flex;
					flex-direction: column;
					font-size: 24rpx;
				}

			}

		}




	}
</style>
